
// NSRefDataToolView.cpp : implementation of the CNSRefDataToolView class
//

#include "stdafx.h"
#include "NSRefDataTool.h"

#include "NSRefDataToolDoc.h"
#include "NSRefDataToolView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CNSRefDataToolView

IMPLEMENT_DYNCREATE(CNSRefDataToolView, CFormView)

BEGIN_MESSAGE_MAP(CNSRefDataToolView, CFormView)
END_MESSAGE_MAP()

// CNSRefDataToolView construction/destruction

CNSRefDataToolView::CNSRefDataToolView() : CFormView(CNSRefDataToolView::IDD)
{
	// TODO: add construction code here

}

CNSRefDataToolView::~CNSRefDataToolView()
{
}

BOOL CNSRefDataToolView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	return CView::PreCreateWindow(cs);
}

// CNSRefDataToolView drawing

void CNSRefDataToolView::OnDraw(CDC* /*pDC*/)
{
	CNSRefDataToolDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: add draw code for native data here
}


// CNSRefDataToolView diagnostics

#ifdef _DEBUG
void CNSRefDataToolView::AssertValid() const
{
	CView::AssertValid();
}

void CNSRefDataToolView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

CNSRefDataToolDoc* CNSRefDataToolView::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CNSRefDataToolDoc)));
	return (CNSRefDataToolDoc*)m_pDocument;
}

void CNSRefDataToolView::DoDataExchange(CDataExchange* pDX)
{
	// TODO: Add your specialized code here and/or call the base class
	DDX_Control(pDX, IDC_SHEET_CTRL, GetDocument()->sheet_ctrl());
	DDX_Control(pDX, IDC_LOG_CTRL, GetDocument()->log_ctrl());

	CFormView::DoDataExchange(pDX);
}

void CNSRefDataToolView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();

	// TODO: Add your specialized code here and/or call the base class
	ResizeParentToFit();

	GetDocument()->sheet_ctrl().SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
	GetDocument()->sheet_ctrl().InsertColumn(0, L"", LVCFMT_LEFT);
	GetDocument()->log_ctrl().SetExtendedStyle(LVS_EX_FLATSB);
	GetDocument()->log_ctrl().InsertColumn(0, L"", LVCFMT_LEFT);

	CNSRefDataToolDoc* pDoc = GetDocument();
	pDoc->Initialize();
}
